chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
  if (changeInfo.url) {
    chrome.runtime.sendMessage({urlChanged: true, url: changeInfo.url});
  }
});